const app = getApp()
const getStatusBarHeight= function (height) {
  return new Promise((resolve,reject)=>{
    if (app.globalData.statusBarHeight) {
      resolve(app.globalData.statusBarHeight)
    }else{
      wx.getSystemInfo({
        success: (result) => {
          const statusBarHeight = result.statusBarHeight ;
          app.globalData.statusBarHeight = statusBarHeight;
          resolve(statusBarHeight)
        },
        fail(result){
          reject(result)
        }
      })
    }
  })
}

module.exports = {
  getStatusBarHeight
}